
<!-- Start of first page -->
<div data-role="page" id="topic">
	<div data-role="header" data-theme="b">
		<a href="#" data-icon="back" onclick="history.go(-1);">返回</a>
		<?php if(empty($id)):?>
		<h1>
			您的帖子 -
			<?php echo Yii::app()->user->name?>
		</h1>
		<?php else:?>
		<h1>
			<?php if(UserIdentity::getUserDetail($id)->nickname==null):?>
				<?php echo $username?>的帖子
			<?php else:?>
				<?php echo UserIdentity::getUserDetail($id)->nickname?>的帖子
			<?php endif?>
		</h1>
		<?php endif?>
		<?php echo CHtml::link("用户",array("user/index"),array("data-icon"=>"star"))?>
	</div>
	<!-- /header -->
	<div data-role="footer">
		<div data-role="navbar" data-theme="e" >
			<ul>
				<li><a data-icon="arrow-l" data-theme="e" href="#topic" >发帖</a></li>
				<li><a data-icon="arrow-r" data-theme="b" href="#post" rel='external'>回帖</a></li>
			</ul>
		</div><!-- /navbar -->
	</div><!-- /footer -->

	<div data-role="content">

	<?php if(count($topics) == 0):?>
	<?php if(empty($id)):?>
		<div class="ui-body ui-body-e">
			<h4>您还未在我们的论坛发布过任何帖子。。</h4>
			<?php echo CHtml::link("论坛首页",array("bbs/index"),array("data-role"=>"button","data-icon"=>"home","data-theme"=>"b"))?>
		</div>
	<?php else:?>
		<div class="ui-body ui-body-e">
			<p>您搜索的这位侠客很懒，还未发过任何帖子。。</p>
		</div>
	<?php endif?>

	<?php else:?>
		<ul data-role="listview"data-theme="d">
			<li>
				<div class="tie-list-top">系统仅显示最新的20个帖子</div>
			</li>
			<?php foreach($topics as $topic):?>
			<li><a rel='external' href="<?php echo Yii::app()->createUrl('bbs/view', array('id'=>$topic->id)); ?> ">	
					<div class="tie-list-title">
					<?php echo "[".$topic->category."]";
						if($topic->created=="2030-10-19 13:09:50"){echo "<font color = red>[置顶]</font>";} 
						if($topic->flag == 'featured'){echo "<font color = red>[精品]</font>";}
						$words_count=Utils::gettitleWordCount();
						if(mb_strlen($topic->title,"UTF-8")>$words_count){
							echo mb_substr($topic->title, 0,$words_count-3,"UTF-8")."...";
						}else{
							echo mb_substr($topic->title, 0,$words_count,"UTF-8");
						}
						?>
					</div>
					<div class="ui-grid-a tie-list-footer">
						<div class="ui-block-a">作者：<?php echo $topic->author?></div>
						<div class="ui-block-b" style ="text-align:right"><?php echo $topic->hits?>阅读<?php echo $topic->comments?>回复</div>
					</div><!-- /grid-a -->
			</a></li>
			<?php endforeach?>
		</ul>
		<?php endif?>
	</div>
	<!--/content-primary -->

	<?php $this->renderPartial("//site/footer")?>
	<!-- /footer -->
	
</div>
<!-- /page -->


<div data-role="page" id="post">
	<div data-role="header" data-theme="b">
		<a href="#" data-icon="back" onclick="history.go(-1);">返回</a>
		<?php if(empty($id)):?>
		<h1>
			您的帖子 -
			<?php echo Yii::app()->user->name?>
		</h1>
		<?php else:?>
		<h1>
			<?php if(UserIdentity::getUserDetail($id)->nickname==null):?>
				<?php echo $username?>的帖子
			<?php else:?>
				<?php echo UserIdentity::getUserDetail($id)->nickname?>的回复
			<?php endif?>
		</h1>
		<?php endif?>
		<?php echo CHtml::link("用户",array("user/index"),array("data-icon"=>"star"))?>
	</div>
	<!-- /header -->
	<div data-role="footer">
		<div data-role="navbar" data-theme="e" >
			<ul>
				<li><a data-icon="arrow-l" data-theme="b" href="#topic" rel='external'>发帖</a></li>
				<li><a data-icon="arrow-r" data-theme="e" href="#post">回帖</a></li>
			</ul>
		</div><!-- /navbar -->
	</div><!-- /footer -->

	<div data-role="content">

	<?php if(count($posts) == 0):?>
	<?php if(empty($id)):?>
		<div class="ui-body ui-body-e">
			<h4>您还未在我们的论坛回复过任何帖子。。</h4>
			<p>点此进入iLook狮城论坛</p>
			<?php echo CHtml::link("论坛首页",array("bbs/index"),array("data-role"=>"button","data-icon"=>"home"))?>
		</div>
	<?php else:?>
		<div class="ui-body ui-body-e">
			<p>您搜索的这位侠客很懒，还未回复过任何帖子</p>
		</div>
	<?php endif?>

	<?php else:?>
		<ul data-role="listview"data-theme="d">
			<li>
				<div class="tie-list-top">系统仅显示最新的20条回复</div>
			</li>
			<?php $n=0;?>
			<?php foreach($posts as $post):?>
			<?php $n++;?>
			<li><a rel='external' href="<?php echo Yii::app()->createUrl('bbs/view', array('id'=>$post->topic_id)); ?> ">	
					<div class="tie-body-content">
						<?php echo strip_tags($post->content);?>
					</div>
					<div class="ui-grid-a tie-list-footer">
						<div class="ui-block-a"><?php echo $n;?></div>
						<div class="ui-block-b" style ="text-align:right"><?php echo mb_substr($post->created,0,16,"UTF-8");?></div>
					</div><!-- /grid-a -->
			</a></li>
			<?php endforeach?>
		</ul>
		<?php endif?>
	</div>
	<!--/content-primary -->

	<?php $this->renderPartial("//site/footer")?>
	<!-- /footer -->
	
</div>
<!-- /page -->
